# Contributor: Damian Kurek <starfire24680@gmail.com>
# Maintainer: Damian Kurek <starfire24680@gmail.com>
pkgname=kodi-game-libretro-snes9x
pkgver=1.60.0.20
_realname=Matrix
pkgrel=0
pkgdesc="Snes9X GameClient for XBMC"
options="!check" # no test suite
url="https://github.com/kodi-game/game.libretro.snes9x"
arch="x86 x86_64 aarch64 armv7" # kodi is available only on those architectures
license="custom"
makedepends="cmake kodi-dev"
depends="kodi-game-libretro libretro-snes9x"
source="$pkgname-$pkgver-$_realname.tar.gz::https://github.com/kodi-game/game.libretro.snes9x/archive/$pkgver-$_realname.tar.gz"
builddir="$srcdir/game.libretro.snes9x-$pkgver-$_realname"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_MODULE_PATH=/usr/lib/cmake/kodi
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
	rm -r "$pkgdir"/usr/share/kodi/addons/game.libretro.snes9x/resources/icon.png \
		"$pkgdir"/usr/share/kodi/addons/game.libretro.snes9x/resources/screenshot* \
		"$pkgdir"/usr/share/kodi/addons/game.libretro.snes9x/changelog.txt \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.snes9x/game.libretro.snes9x.so
	ln -s /usr/lib/libretro/snes9x_libretro.so \
		"$pkgdir"/usr/lib/kodi/addons/game.libretro.snes9x/game.libretro.snes9x.so
}

sha512sums="
8306989b775e26772b83362d3f9c9a3d581e661422280b57aa718035ce0222da35e1ad7c15ddcf8016cd0851e85c8d48c7487dcc7e04b1d760aed87817894513  kodi-game-libretro-snes9x-1.60.0.20-Matrix.tar.gz
"
